package com.lg.system.role.entity;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.lg.common.validate.Delete;
import com.lg.common.validate.Insert;
import com.lg.common.validate.Search;
import com.lg.common.validate.Update;
import com.lg.utils.Page;
import com.lg.utils.PageModel;

/**
 * <p>
 * 角色
 * </p>
 *
 * @author dl
 * @since 2018-03-19
 */
@TableName("sys_role")
//在解析成json时，忽略父类的该属性，但是允许赋值，不允许返回值
@JsonIgnoreProperties(value={Page.sort,Page.order,Page.rows,Page.total,Page.limit,Page.offset,Page.code},allowSetters=true)
public class Role extends PageModel {

    private static final long serialVersionUID = 1L;

    @TableId(value = "role_id", type = IdType.AUTO)
    @NotNull(message = "角色ID不能为空", groups = {Delete.class,Search.class,Update.class})
    private Long roleId;

    /**
     * 角色名称
     */
    @TableField("role_name")
    @NotNull(message = "角色名称不能为空", groups = {Insert.class})
    private String roleName;

    /**
     * 角色标识
     */
    @TableField("role_sign")
    @NotNull(message = "角色标识不能为空", groups = {Insert.class})
    private String roleSign;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建用户id
     */
    @TableField("create_id")
    private Long createId;

    @TableField("modified_id")
    private Long modifiedId;

    /**
     * 创建时间
     */
    @TableField("gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @TableField("gmt_modified")
    private Date gmtModified;

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }
    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
    public String getRoleSign() {
        return roleSign;
    }

    public void setRoleSign(String roleSign) {
        this.roleSign = roleSign;
    }
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }
    public Long getModifiedId() {
        return modifiedId;
    }

    public void setModifiedId(Long modifiedId) {
        this.modifiedId = modifiedId;
    }
    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }
    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    @Override
    protected Serializable pkVal() {
        return this.roleId;
    }

    @Override
    public String toString() {
        return "Role{" +
        "roleId=" + roleId +
        ", roleName=" + roleName +
        ", roleSign=" + roleSign +
        ", remark=" + remark +
        ", createId=" + createId +
        ", modifiedId=" + modifiedId +
        ", gmtCreate=" + gmtCreate +
        ", gmtModified=" + gmtModified +
        "}";
    }
}
